home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Answers 2002 January
/
PC Answers January 2002.7z
/
PC Answers January 2002.bin
/
graphics
/
freepixl
/
_SETUP.1
/
CmdExtns.pxl
< prev
next >
Wrap
Text File
|
2001-10-04
|
7KB
|
237 lines
{ Filename : CmdExtns.pxl
Purpose : Show how thr Extension commands work.
Date : 04 October, 2001
Author : Stewart DIBBS, VYSOR
History:
Version : 5.1 RELEASE
Update :
Date :
--------------------------------------------------------------------------}
Initialize: {only one instance allowed}
UseCoordinates(PIXEL)
Title$ = "PiXCL Extension Commands"
WinExist(Title$,Res)
If Res = 0 Then Goto One_Instance
Beep
WinSetActive(Title$,Res)
WinShow(Title$,RESTORE,Res)
End
One_Instance:
UseCaption(Title$) {change the title}
WinLocate(Title$,238,96,860,520,Res)
UseBackground(TRANSPARENT,0,128,192)
WinShow(Title$,NOTOPMOST,Res)
DrawBackGround
DirGet(SourceDir$) {used later for library function calls}
DragAcceptFile(ENABLE,AcceptFile)
AutoProgressBar(DISABLE)
InfoMenu(REMOVE)
WaitInput(100)
SetMenu("&File",IGNORE,
"&New",CreatingFile,
"&Open",OpeningFile,
"&Save",SavingFile,
SEPARATOR,
"E&xit!",Terminate,
ENDPOPUP,
"&View",IGNORE,
"&ToolBar",ViewToolBar,
"&StatusBar",ViewStatusBar,
ENDPOPUP,
"&Information",IGNORE,
"&Concept",Concept,
"&Help",ShowAppHelp,
SEPARATOR,
"&About",About,
ENDPOPUP)
GoSub MakeToolbar
ChangeMenuItem("&ToolBar",CHECK,TBRes)
StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
DrawStatusWinText(0,"Ready")
ChangeMenuItem("&StatusBar",CHECK,SBRes)
Wait_for_Input:
WaitInput()
Terminate:
End
Concept:
MessageBox(OK,1,INFORMATION,
"This is a skeleton of a PiXCL application. You could briefly
describe your application's function here, or provide some
basic help information.",
"PiXCL Skeleton Concept",Res)
Goto Wait_for_Input
ShowAppHelp:
{An application Help file usually has the same name as the application.}
Winhelp("CmdExtns.hlp",CONTENTS,"")
Goto Wait_for_Input
About:
AboutUser(Title$,
"Two lines of text goes here e.g. Application function.",
"Four Lines of additional information goes here, perhaps contact information and Web addresses")
Goto Wait_for_Input
ViewToolBar:
GetMenuStatus("&ToolBar",CHECKED,Res)
If Res = 0
GoSub MakeToolbar
ChangeMenuItem("&ToolBar",CHECK,Res)
Else
Toolbar()
ChangeMenuItem("&ToolBar",UNCHECK,Res)
Endif
Goto Wait_for_Input
ViewStatusBar:
GetMenuStatus("&StatusBar",CHECKED, Res)
If Res = 0
StatusWindow(ENABLE,BOTTOM,2,200,-1,0,0)
DrawStatusWinText(0,"Ready")
ChangeMenuItem("&StatusBar",CHECK,Res)
Else
StatusWindow(DISABLE,BOTTOM,2,200,-1,0,0)
ChangeMenuItem("&StatusBar",UNCHECK,Res)
Endif
Goto Wait_for_Input
CreatingFile:
WaitInput(1)
FreeVar(Folder$)
GetSpecialFolder("Locate Network Information",NETWORK,BROWSEINCLUDEFILES,Folder$)
DebugMsgBox(Folder$)
Goto Wait_for_Input
OpeningFile:
WaitInput(1)
Search$ = SourceDir$ + "\*.pxl"
FileExist(Search$,Res)
DebugMsgBox(Res)
DirListFiles(Search$,"|",Number,List$)
DebugMsgBox(Number)
DebugMsgBox(List$)
Goto Wait_for_Input
SavingFile:
WaitInput(1)
DrawBackground
UseFont("Arial",13,27,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
DrawShadowText(20,40,"An Extension Command API is available",255,255,255,1)
UseFont("Arial",9,19,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
UserDLL$ = "PXLucmds.dll"
GeoPIXCLDLLABout(UserDLL$,Res)
RegisterUserCommand(UserDLL$,"gpxUser_1",Res, P_STRING, P_NUMBER,
P_FP_NUMBER, P_FP_VARIABLE, P_NUM_VARIABLE)
If Res = 2 Then DebugMsgBox("User Command#1 OK,1 arg, already registered")
RegisterUserCommand(UserDLL$,"gpxUser_2",Res, P_STRING, P_NUM_VARIABLE,
P_COORDINATE, P_RGB, P_NUM_VARIABLE)
If Res = 2 Then DebugMsgBox("User Command#2 OK, multiple args, already registered")
RegisterUserCommand(UserDLL$,"gpxUser_3",Res, P_STRING,
P_NUMBER, P_NUM_VARIABLE)
DrawText(20,70,"1: Set initial values and do an FP calculation in a DLL")
Mux& = 13.7885 {set an inital value}
gpxUser_1("string",10, 2.334, Mux&, Res)
If Res = -1 Then DebugMsgBox("Can't find the command in the User DLL")
DebugMsgBox(Mux&)
DrawText(20,90,"2: Set initial values and do a integer calculation in a DLL.")
gpxUser_2("string",FnNumber, 12,12, 1,2,3, Res)
If Res = -1 Then DebugMsgBox("Can't find the command in the User DLL")
DebugMsgBox(FnNumber) {should be 137}
DrawText(20,110,"3: Pass a string into a DLL, display custom dialogs.")
gpxUser_3("string",10,Res)
DrawText(20,130,"4: Display a common dialog in a DLL and return a filename")
RegisterUserCommand(UserDLL$,"gpxUser_4",Res, P_STR_VARIABLE,
P_NUM_VARIABLE)
OpenFileInDLL$ = "Test"
gpxUser_4 (OpenFileInDLL$,Res)
DebugMsgBox(OpenFileInDLL$)
DrawText(20,150,"5: Access other geoPiXCL DLLs, if installed.")
RegisterUserCommand(UserDLL$,"gpxUser_5",Res, P_COORDINATE, P_NUM_VARIABLE)
gpxUser_5 (-100,100,Res)
DrawText(20,170,"6: Display more custom dialogs within a DLL.")
RegisterUserCommand(UserDLL$,"gpxUser_6",Res, P_COORDINATE,P_NUM_VARIABLE)
gpxUser_6 (-100,100,Res)
UseFont("Arial",13,27,BOLD,NOITALIC,NOUNDERLINE,0,0,0)
DrawShadowText(20,200,"The Extension Command API costs C$350",255,255,255,1)
UseFont("Arial",9,19,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
DrawText(40,240,"Applicable provincial taxes and GST are extra.")
DrawText(40,260,"Please contact VYSOR Integration directly. We take VISA.")
UnregisterUserCmds(Count)
Goto Wait_for_Input
GradientFiller:
WaitInput(1)
DrawBackground
DrawShadeRectangle(80,80,200,320, 0,0,0, 0,0,224, BOTTOMTOP)
GradientFillRect(220,80,420,320,HORZ, 0,0,0, 0,0,224)
Goto Wait_for_Input
PrintingFile:
WaitInput(1)
{TODO: add file handling here}
MessageBox(OK,1,INFORMATION,"No operations coded for this button.",
"Printing File",Res)
Goto Wait_for_Input
AcceptFile:
GetDragList(FileList$)
{TODO: add file list handling here, or delete this whole label handler}
Goto Wait_for_Input
{--- Style Suggestion: place all subroutines at the end of the script.}
MakeToolbar: {subroutine}
Toolbar( FLAT, PXL_LARGE,
NULL, NULL, SEPARATOR, "", Wait_for_Input,
PXL_NEW, ENABLED, STD, "GetSpecialFolder Test", CreatingFile,
PXL_OPEN, ENABLED, STD, "DirListFiles Test", OpeningFile,
PXL_SAVE, ENABLED, STD, "Show Extension Commands", SavingFile,
PXL_PRINT, ENABLED, STD,"PrintFile", PrintingFile,
FLOOD, ENABLED, STD,"Gradient Filling",GradientFiller,
NULL, NULL, SEPARATOR, "", Wait_for_Input,
HELPINFO, ENABLED, STD,"Show Help",ShowAppHelp,
NULL, NULL, SEPARATOR, "", Wait_for_Input)
Return